#ifndef AST_DECLARATIONS_DESIGNATOR_H
#define AST_DECLARATIONS_DESIGNATOR_H

#include "../ASTNode.h"
class ConstantExpr;
class sym;

/*
C99   6.7.8
designator:
		[   constant-expression   ]
		.   identifier
*/
class Designator : public ASTNode
{
	enum{
		identifier,
		constant_expr,
	};
protected:
	Designator(void)
		: ASTNode(ASTNode::designator){};
public:
	explicit Designator(sym * pIdentifier)
		: ASTNode(ASTNode::designator)
		, m_iType(identifier)
		, m_pIdentifier(pIdentifier){};
	explicit Designator(ConstantExpr * pConsExpr)
		: ASTNode(ASTNode::designator)
		, m_iType(constant_expr)
		, m_pConsExpr(pConsExpr) {};

	virtual ~Designator(void);

	virtual void				codeGen();

protected:
	tiny_int					m_iType;
	union{
		sym *					m_pIdentifier;
		ConstantExpr *			m_pConsExpr;
	};
};


#endif

